﻿using System;
using System.Collections.Generic;
using System.Text;

namespace TRPOP.Common
{
    /// <summary>
    /// 信息状态枚举
    /// </summary>
    public enum InfoStatus
    {

        /// <summary>
        /// 屏蔽，后台显示，前台不显示
        /// </summary>
        Hidden = 1,

        /// <summary>
        /// 逻辑删除，前后台都不显示
        /// </summary>
        Deleted = 2,

        /// <summary>
        /// 屏蔽列表显示，前台列表不显示，搜索显示
        /// </summary>
        HiddenInList = 3,

        /// <summary>
        /// 审核未通过
        /// </summary>
        NotPass = 4,

        /// <summary>
        /// 信息未审核
        /// </summary>
        UnAudit = 5, 

        /// <summary>
        /// 未发布，但是信息正常
        /// </summary>
        UnPublishButNormal = 6,

        /// <summary>
        /// 信息已发布
        /// </summary>
        Publish=7
    }
    /// <summary>
    /// 信息状态
    /// </summary>
    public class InfoStatusManage
    {
        /// <summary>
        /// 信息状态列表
        /// </summary>
        /// <returns></returns>
        public static List<StatusInfo> GetAll()
        {
            List<StatusInfo> olstInfo = new List<StatusInfo>();
            StatusInfo oInfo = null;
            oInfo = new StatusInfo();
            oInfo.DisplayText = "屏蔽";
            oInfo.Value = (int)InfoStatus.Hidden;
            olstInfo.Add(oInfo);

            oInfo = new StatusInfo();
            oInfo.DisplayText = "删除";
            oInfo.Value = (int)InfoStatus.Deleted;
            olstInfo.Add(oInfo);

            oInfo = new StatusInfo();
            oInfo.DisplayText = "屏蔽列表显示";
            oInfo.Value = (int)InfoStatus.HiddenInList;
            olstInfo.Add(oInfo);

            oInfo = new StatusInfo();
            oInfo.DisplayText = "审核未通过";
            oInfo.Value = (int)InfoStatus.NotPass;
            olstInfo.Add(oInfo);

            oInfo = new StatusInfo();
            oInfo.DisplayText = "信息未审核";
            oInfo.Value = (int)InfoStatus.UnAudit;
            olstInfo.Add(oInfo);

            oInfo = new StatusInfo();
            oInfo.DisplayText = "未发布";
            oInfo.Value = (int)InfoStatus.UnPublishButNormal;
            olstInfo.Add(oInfo);

            oInfo = new StatusInfo();
            oInfo.DisplayText = "已发布";
            oInfo.Value = (int)InfoStatus.Publish;
            olstInfo.Add(oInfo);

            return olstInfo;
        }
        /// <summary>
        /// 信息状态DisplayText
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static string GetInfoStatusDisplayText(int id)
        {
            string strName = "";
            List<StatusInfo> olstInfo = GetAll();
            StatusInfo oInfo = olstInfo.Find(delegate(StatusInfo info) { return info.Value == id; });
            if (oInfo != null)
            {
                strName = oInfo.DisplayText;
            }
            return strName;
        }
    }
    /// <summary>
    /// 约克cms 发布状态
    /// </summary>
    public class PubStatus 
    {
        /// <summary>
        /// 发布状态
        /// </summary>
        public  enum EnumElement {
            
            /// <summary>
            /// 待发布
            /// </summary>
            UnPublish=0,
            /// <summary>
            /// 已发布
            /// </summary>
            Publish=1,
            /// <summary>
            /// 删除
            /// </summary>
            Delete=-1

        }
        /// <summary>
        /// GetAll
        /// </summary>
        /// <returns></returns>
        public static Dictionary<int, string> GetAll()
        {
            Dictionary<int, string> dicList = new Dictionary<int, string>();
            dicList.Add((int)EnumElement.Delete, "删除");
            dicList.Add((int)EnumElement.Publish, "已发布");
            dicList.Add((int)EnumElement.UnPublish, "待发布");

            return dicList;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public static string GetValue(int key)
        {
            string strValue = "";
           
                if (GetAll().ContainsKey(key))
                {
                    return GetAll()[key];
                }
            
            return strValue;
        }


    }
    
}
